package systems;

import java.util.ArrayList;
import java.util.Collections;

import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheManager;

public class RecentlyDomain {
	
	private static String cacheName = "currentDomain";
	
	private static int limit = 450;
	
	private static ArrayList<String> domains = new ArrayList<String>();
	
	public static void insert(String name) {
		
		if (domains.contains(name)) {
			domains.remove(name);
		}
		
		if (domains.size() >= limit) {
			domains.remove(limit);
		}
		
		domains.add(0, name);
		
	}
	
	public static ArrayList<String> getDomains() {
		
		return domains;
	}
}
